package com.itqf.controller;

import com.itqf.bean.DtsAdmin;
import com.itqf.service.DtsDashboardService;
import com.itqf.util.ResponseUtil;
import com.itqf.utils.AuthSupport;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * projectName: gp_manage
 *
 * @author: 赵伟风
 * time: 2021/8/18 11:25
 * description:
 */
@RequestMapping("admin")
@RestController
@CrossOrigin("*")
public class DtsDashboardController {

    @Autowired
    private DtsDashboardService dtsDashboardService;




    /**
     * 查询面板数据
     * @return
     */
    @GetMapping("dashboard")
    public Object dashboard(){

        DtsAdmin dtsAdmin = AuthSupport.currentUser();

        Map<String,String> data =  dtsDashboardService.findNumber(dtsAdmin);

        return ResponseUtil.ok(data);
    }


    /**
     * 页面图表数据接口
     *    类别销售额
     *    订单增长量
     *    用户增长量
     * @return
     */
    @GetMapping("dashboard/chart")
    public Object chart(){

        Map<String,Object> data =  dtsDashboardService.findChart();

        return ResponseUtil.ok(data);
    }
}
